import {handleActions} from 'redux-actions';

import { COMPANY_QUERY, COMPANY_UPDATE } from '../actions/ActionTypes.js'

const company = handleActions({
  [COMPANY_QUERY.REQUEST](state) {
    return {...state, loading: true,};
  },
  [COMPANY_QUERY.SUCCESS](state, action) {
    return {...state, ... action.payload, loading: false,};
  },
  [COMPANY_QUERY.FAILURE](state, action) {
    return {...state, err: action.err, loading: false,};
  },
  [COMPANY_UPDATE](state, action) {
    return {...state, ... action.payload, loading: false,};
  },
}, {
  loading:false,
  err:{}
});

export default company;
